package com.vates.vsp;

import java.util.*;

public class Cuenta {

	private static int  saldo= 50;
	
	public Cuenta(){
		this.saldo=50;
	}
	
	
	
	public synchronized static void sacar(){
		
		try {		
			Thread.sleep(500);
		} catch (InterruptedException e) {
			;
		}
		
		if(Saldo()>=10){
			saldo=saldo-10;

			System.out.println(Thread.currentThread().getName());
			System.out.println("Su saldo es de: "  + saldo);
		}
		else
			 System.out.println("Su saldo es negativo");
	
	}
	
	
	public synchronized static int Saldo()
	{
		return saldo;
	}
}
